package com.yanshaohui.feign;

import com.yanshaohui.bean.Person;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * Created by TS-Ysh on 2018-05-16.
 */
@FeignClient(value = "REACTIVE")
public interface ProviderReactive {
    @GetMapping("/person/{id}")
    public Person getOnePerson(@PathVariable("id") Long id);

    /**
     * springmvcweb方式，和上面React方式比较一下性能
     * @param id
     * @return
     */
    @GetMapping("/person2/{id}")
    public Person getOnePerson2(@PathVariable("id") Long id);

    @GetMapping("/persons")
    public List<Person> getAllPerson();


    @GetMapping("/test1")
    public ServerResponse test1();

    /**
     * 把提供者的Flux<String>换成String Array试试结果
     * 结果表明，array不行
     * @return
     */
//    @GetMapping("/people")
//    String[] test2();

    /**
     * 事实证明不是list和array的问题，flux<string>返回的是个字符串，不是数组或list
     * @return
     */
//    @GetMapping("/people")
//    List<String> test2();

    @GetMapping("/people")
    String test2();
}
